import { register } from 'module';
import request from '/@/utils/request';
import { countdownEmits } from 'element-plus';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 登录api接口集合
 * @method signIn 用户登录
 * @method signOut 用户退出登录
 */
export function useCouponApi() {
	
	return {
		//  查询优惠券/获取所有有虎拳
		select: (params?: object) => {
			return request({
				url: '/merchant/coupon/querySearch',
				method: 'get',
				params:params,
			});
		},

		//获取当前商户所有优惠券
		query: (params?: object) => {
			return request({
				url: '/merchant/coupon/queryCoupon',
				method: 'get',
				params:params,
			});
		},

        //新增优惠券
		add: (data: object) => {
			return request({
				url: '/merchant/coupon/addCoupon',
				method: 'post',
				data,
			});
		},
        //修改优惠券
		update: (data: object) => {
			return request({
				url: '/merchant/coupon/updateCoupon',
				method: 'post',
				data,
			});
		},
		  //删除优惠券z
		  delete:(params?:object)=>{
			return request({
				url: '/merchant/coupon/deleteCoupon',
				method: 'delete',
				params:params,
			});
		  }
	};
}
